/*_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/                                                                            _/
_/                      _/  _/                  _/                            _/
_/       _/_/_/    _/_/_/  _/_/_/      _/_/_/  _/_/_/      _/_/_/  _/  _/_/   _/
_/    _/    _/  _/    _/  _/    _/  _/    _/  _/    _/  _/    _/  _/_/        _/
_/   _/    _/  _/    _/  _/    _/  _/    _/  _/    _/  _/    _/  _/           _/
_/    _/_/_/    _/_/_/  _/_/_/      _/_/_/  _/_/_/      _/_/_/  _/            _/
_/       _/                                                                   _/
_/   _/_/                              Free software copyrighted since 2007   _/
_/                                              <gdbabar@gmail.com>           _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/*/

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#ifdef ENABLE_NLS
#  include <glib/gi18n-lib.h>
#else
#  define _(String) (String)
#endif

#include <gtk/gtk.h>
#include <stdlib.h>

#include "common.h"
#include "gdbabar.h"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#define DOCK_AREA_MAX_HEIGHT 64+11
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
enum
{
  GDB_ON_BOTTOM,
  GDB_ON_TOP,
  GDB_ON_LEFT,
  GDB_ON_RIGHT
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
typedef struct _DockArea
  {
    gint x_pos;
    gint y_pos;
    gint x_dim;
    gint y_dim;
  }
DockArea;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static gint gdb_position = GDB_ON_BOTTOM; // Dock bar on bottom by default
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int
main (int argc, char *argv[])
{

  GtkWidget *window;
  GdkScreen *gdkscreen = NULL;
  DockArea dock_area;

#ifdef ENABLE_NLS

  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);

#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  if (is_first_run() == TRUE)
    {
      g_message ("No configuration directory file");
      // set dock bar on bottom
    }
  else
    {
      // read dock bat position information
    }

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  gtk_widget_set_app_paintable (window, TRUE);
  gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
  gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
  gtk_window_set_title (GTK_WINDOW (window), "gdbabar");

  gdkscreen = gtk_window_get_screen(GTK_WINDOW (window));
  int gdb_screen_height = gdk_screen_get_height(gdkscreen);
  int gdb_screen_width = gdk_screen_get_width(gdkscreen);

  switch (gdb_position)
    {
    case GDB_ON_BOTTOM:
      g_print("[I] Dock on bottom\n");
      dock_area.x_dim = gdb_screen_width/2;
      dock_area.y_dim = DOCK_AREA_MAX_HEIGHT;
      dock_area.x_pos = gdb_screen_width/4;
      dock_area.y_pos = gdb_screen_height - DOCK_AREA_MAX_HEIGHT;
      break;

    case GDB_ON_TOP:
      g_print("[I] Dock on top\n");
      dock_area.x_dim = gdb_screen_width/2;
      dock_area.y_dim = DOCK_AREA_MAX_HEIGHT;
      dock_area.x_pos = gdb_screen_width/4;
      dock_area.y_pos = 0;
      break;

    case GDB_ON_LEFT:
      g_print("[I] Dock on left\n");
      dock_area.x_dim = DOCK_AREA_MAX_HEIGHT;
      dock_area.y_dim = gdb_screen_height/2;
      dock_area.x_pos = 0;
      dock_area.y_pos = gdb_screen_height/4;
      break;

    case GDB_ON_RIGHT:
      g_print("[I] Dock on right\n");
      dock_area.x_dim = DOCK_AREA_MAX_HEIGHT;
      dock_area.y_dim = gdb_screen_height/2;
      dock_area.x_pos = gdb_screen_width - DOCK_AREA_MAX_HEIGHT;
      dock_area.y_pos = gdb_screen_height/4;
      break;
    }

  gtk_widget_set_size_request (window, dock_area.x_dim, dock_area.y_dim);
  gtk_window_move (GTK_WINDOW(window), dock_area.x_pos, dock_area.y_pos);
  //gtk_window_set_skip_taskbar_hint(GTK_WINDOW (window), TRUE);

  g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_window_signal), NULL);

  gtk_widget_show_all (window);

  gtk_main ();

  return EXIT_SUCCESS;

}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
